package com.tkx.dxb.service.base.exception;


import com.tkx.dxb.common.base.result.ResultCodeEnum;
import lombok.Data;

/**
 * @author : victor
 * @since : 2020/11/2
 */
@Data
public class DxbException extends RuntimeException{

    private Integer code;

    public DxbException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    /**
     * 接收枚举类型
     * @param resultCodeEnum
     */
    public DxbException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    @Override
    public String toString() {
        return "DxbException{" +
                "code=" + code +
                "，message=" + this.getMessage() +
                '}';
    }
}
